package com.yz10000rmb.controller;

import javax.annotation.Resource;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;

import com.yz10000rmb.entity.User;
import com.yz10000rmb.service.user.UserService;

@Controller
public class UserController implements BaseController {

	private User user;
	
//	@Resource(name="userService")
//	private UserService userService;
	
	private static UserService userService;
	
	private static ApplicationContext ac;
	
	static {
		ac = new ClassPathXmlApplicationContext("applicationContext.xml");
		userService = (UserService) ac.getBean("userService");
	}
	
	public String find() {
		this.user = userService.findUser();
		System.out.println(user.getName());
		System.out.println(user.getPassword());
		return "ok";
	}
	
	public String insert() {
		userService.insert();
		return "ok";
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
